package com.example.recyclerviewlearn;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.asynclayoutinflater.view.AsyncLayoutInflater;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;

public class AsyncLoadActivity extends AppCompatActivity {
    private static final String TAG = "AsyncLoadActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        new AsyncLayoutInflater(this).inflate(R.layout.activity_async_load, null, new AsyncLayoutInflater.OnInflateFinishedListener() {
            @Override
            public void onInflateFinished(@NonNull View view, int resid, @Nullable ViewGroup parent) {
                setContentView(R.layout.activity_main);
                Log.i(TAG, "onInflateFinished: ");
            }
        });
        Log.i(TAG, "onCreate: end");
        Log.i(TAG, "onCreate: start bitmap");
        Bitmap bitmap2 = BitmapFactory.decodeResource(getResources(), R.drawable.full);
        Log.i(TAG, "onCreate: bitmap2 " + bitmap2.getWidth() + " " + bitmap2.getHeight());
        Log.i(TAG, "onCreate: bitmap2 " + bitmap2.getByteCount() + " getApplicaitionCount " + bitmap2.getAllocationByteCount());
        Log.i(TAG, "onCreate: bitmap2 " + bitmap2.getConfig());
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inDensity = 2;
        options.inTargetDensity = 1;
        Log.i(TAG, "onCreate: start option");
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.full, options);
        Log.i(TAG, "onCreate: bitmap" + bitmap.getWidth() + " " + bitmap.getHeight());

        Log.i(TAG, "onCreate: bitmap" + bitmap.getByteCount() + " getApplicaitionCount " + bitmap.getAllocationByteCount());
        Log.i(TAG, "onCreate: bitmap" + bitmap.getConfig());
    }
}